ActionController::Routing::Routes.draw do |map|
  map.resources :todo_comments

  map.resources :feedbacks
  map.resources :stories,:controller => 'admin/stories', :path_prefix => 'admin'
  map.resources :emails,:controller => 'admin/emails', :path_prefix => 'admin'
  map.resources :payments,:controller=> 'admin/payments', :path_prefix => 'admin'

  map.resources :plans,:controller=>'admin/plans',
                :path_prefix => 'admin'

  map.resources :features,:controller=>'admin/features',
                :path_prefix => 'admin'

  map.resources :projects,:collection=>{:modal=>:get,:ms=>:get,:desc=>:get}  do |project|
    project.resources :messages do |message|
      message.resources :comments
    end
    project.resources :milestones
    project.resources :logs
    project.resources :todos
    project.resources :writeboards,:collection => {:wiki=>:get,:diff=>:post}
    project.resources :files,:collection=>{:download=>:get}
    project.resources :ims
    project.resources :time_logs,:collection => {:export=>:get}
    project.resources :people
    project.resources :permission,:collection => {:edit=>:post,:nopermission=>:get}
    project.resources :project_setting
  end
  map.resources :people
  map.project_action 'projects/act/:action',:controller=>'projects'
  map.deliver_chart '/projects/:project_id/deliver',:controller=>'projects',:action=>'deliver_chart'
  map.activity_xml '/statistic/activity_xml/:pids',:controller=>'statistic',:action=>'activity_xml'
  map.deliver_chart2 '/projects/:project_id/data.xml',:controller=>'projects',:action=>'deliver_chart'

  #message list with a specify category
  map.project_msg_in_category '/projects/:project_id/messages/category/:category_id',:controller=>"messages",:action=>'index'
  map.project_wb_in_category '/projects/:project_id/writeboards/category/:category_id',:controller=>"writeboards",:action=>'index'
  map.project_file_in_category '/projects/:project_id/files/category/:category_id',:controller=>"files",:action=>'index'

  #permission issue
  map.edit_role '/permission/edit/:id',:controller=>"permission",:action=>'edit'
  map.delete_role '/permission/delete/:id',:controller=>"permission",:action=>'destroy'

  map.connect '',:controller=>"home",:action=>'index'
  map.admin '/admin',:controller=>"admin/home",:action=>'index'
  map.connect ':controller/:action/:id'
  map.pagerank 'pagerank.gif',:controller=>'pagerank',:action=>'show'


end
